package com.huan.controller;

import com.huan.VO.PageVo;
import com.huan.domain.ResponseResult;
import com.huan.domain.entity.Tag;
import com.huan.domain.entity.TagListDto;
import com.huan.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/content/tag")
public class TagController {
    @Autowired
    private TagService tagService;

    @GetMapping("/list")
    public ResponseResult<PageVo> list(Integer pageNum, Integer pageSize, TagListDto tagListDto){
        return tagService.pageTagList(pageNum,pageSize,tagListDto);
    }
    @GetMapping("/listAllTag")
    public ResponseResult<PageVo> getAllTag(){
        return tagService.getAllTag();
    }
    @PostMapping("")
    public ResponseResult addTag(@RequestBody Tag tag){return tagService.addTag(tag);}
    @DeleteMapping("{id}")
    public ResponseResult deleteTag(@PathVariable Long id){return tagService.delTag(id);}

    @GetMapping("{id}")
    public ResponseResult getTag(@PathVariable Long id){return tagService.getTag(id);}
    @PutMapping("")
    public ResponseResult upTag(@RequestBody Tag tag){return tagService.upTag(tag);}

















}

